﻿<?
if($results>0){
?>
<div class="commande m">
	<table>
		<tr>
			<td colspan="2" class="top"><img src="/img/common/commander.gif" alt="Commander" /></td>
		</tr>
		<tr>
			<td colspan="2" class="bar"><img src="/img/common/lightgreybar.gif" alt="" /></td>
		</tr>
		<? 
			$query = "SELECT * FROM produit, asso_pro_rec 
							WHERE asso_pro_rec.reca_id = $id 
							AND produit.pro_id = asso_pro_rec.proa_id
							GROUP BY asso_pro_rec.proa_id";
			$q1 = mysql_query($query);
			$nb = mysql_num_rows($q1);
			$combos="";
			$prices="";
			$prods="";
			$j = 0;
			while ($product = mysql_fetch_array($q1) ){				
				$j++;
				$combos .= "'combo_1_$j'";
				if($j<$nb) $combos .= ",";
				$prices .= "'".$product['pro_prix']."'";
				if($j<$nb) $prices .= ",";
				$prods .= "'".$product['pro_id']."'";
				if($j<$nb) $prods .= ",";
			}
			$total = 0;
			$combon = 1;
			$q1 = mysql_query($query);
			while ($product = mysql_fetch_array($q1)){
			?>
			<tr>
				<td class="left"><? echo $product['pro_nom']; ?></td>
				<td class="right">
				<select id="combo_1_<? echo $combon ?>" onchange="updatePrice(new Array(<? echo $combos ?>), new Array(<? echo $prices ?>), new Array(<? echo $prods ?>));">
					<option value="0">0</option>
					<option value="1" selected="yes">1</option>
					<? 
					for($i=2;$i<=10;$i++){
					?>
					<option value="<? echo $i ?>"><? echo $i ?></option>
					<? } ?>
				</select>
			</td>
			</tr>
			<?
			$total = $total + $product['pro_prix'];
			$combon++;
		}
		?>
		<tr>
			<td class="price left">PRIX</td>
			<td class="price right" id="total">EUR <? echo $total ?>&nbsp;</td>
		</tr>
		<tr>
			<td colspan="2" class="info left"><strong>En stock</strong><br /><span>Livraison sous 48h</span></td>
		</tr>
		<tr>
			<td colspan="2" class="bar"><img src="/img/common/greybar.gif" alt="" /></td>
		</tr>
		<tr>
			<td colspan="2" class="addcart"><a id="addcartbtn" href="#"><img src="/img/common/addcart_l.gif" alt="Ajouter au panier" /></a></td>
		</tr>
		<tr>
			<td colspan="2" class="bottom"></td>
		</tr>
	</table>
	<div class="info">
		<a href="#">Voir les conditions de livraison</a><br />
		<a href="#">Voir les conditions de remboursement</a><br /><br />
	</div>
</div>
<? } ?>